<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.7.0" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=6.4.2" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=6.4.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=6.4.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=6.4.2">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=6.4.2" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Gemini',
    version: '6.4.2',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="DevOps（Development和Operations的组合词）是一组过程、方法与系统的统称，用于促进开发（应用程序/软件工程）、技术运营和质量保障（QA）部门之间的沟通、协作与整合。它是一种重视“软件开发人员（Dev）”和“IT运维技术人员（Ops）”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程，来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。它的出现是由">
<meta name="keywords" content="Linux服务器">
<meta property="og:type" content="article">
<meta property="og:title" content="DevOps">
<meta property="og:url" content="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/index.html">
<meta property="og:site_name" content="厦门工学院">
<meta property="og:description" content="DevOps（Development和Operations的组合词）是一组过程、方法与系统的统称，用于促进开发（应用程序/软件工程）、技术运营和质量保障（QA）部门之间的沟通、协作与整合。它是一种重视“软件开发人员（Dev）”和“IT运维技术人员（Ops）”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程，来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。它的出现是由">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://xit-edu.cn/blog/2022/01/06/blog/dev-ops/dev-ops/DevOps.png">
<meta property="og:image" content="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/Continuous%20Integration.png">
<meta property="og:image" content="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/Continuous%20Delivery.jpg">
<meta property="og:image" content="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/Continuous%20Deployment.jpg">
<meta property="og:image" content="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/buy_ca.png">
<meta property="og:updated_time" content="2023-03-25T11:37:13.994Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="DevOps">
<meta name="twitter:description" content="DevOps（Development和Operations的组合词）是一组过程、方法与系统的统称，用于促进开发（应用程序/软件工程）、技术运营和质量保障（QA）部门之间的沟通、协作与整合。它是一种重视“软件开发人员（Dev）”和“IT运维技术人员（Ops）”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程，来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。它的出现是由">
<meta name="twitter:image" content="https://xit-edu.cn/blog/2022/01/06/blog/dev-ops/dev-ops/DevOps.png">






  <link rel="canonical" href="https://xit-edu.cn/2022/01/06/blog/dev-ops/dev-ops/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>DevOps | 厦门工学院</title>
  






  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?d3f181d3d99fc3c240567d5b682eebd1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">厦门工学院</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">软件研发工作室</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/blog/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/blog/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/blog/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/blog/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-works1">
    <a href="/blog/works1/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br>H5小游戏1</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-works2">
    <a href="/blog/works2/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>H5小游戏2</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-fiction">
    <a href="/blog/fiction/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>大将军归来</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/blog/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://xit-edu.cn/blog/2022/01/06/blog/dev-ops/dev-ops/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="对美好事物的向往，心中要充满强烈的愿望！">
      <meta itemprop="description" content="沉淀下来的知识，才是真正的财富！">
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="厦门工学院">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">DevOps
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2022-01-06 18:30:00" itemprop="dateCreated datePublished" datetime="2022-01-06T18:30:00+08:00">2022-01-06</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2023-03-25 19:37:13" itemprop="dateModified" datetime="2023-03-25T19:37:13+08:00">2023-03-25</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/blog/categories/开发运维平台/" itemprop="url" rel="index"><span itemprop="name">开发运维平台</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/blog/categories/开发运维平台/服务器/" itemprop="url" rel="index"><span itemprop="name">服务器</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>DevOps（Development和Operations的组合词）是一组过程、方法与系统的统称，用于促进开发（应用程序/软件工程）、技术运营和质量保障（QA）部门之间的沟通、协作与整合。<br>它是一种重视“软件开发人员（Dev）”和“IT运维技术人员（Ops）”之间沟通合作的文化、运动或惯例。透过自动化“软件交付”和“架构变更”的流程，来使得构建、测试、发布软件能够更加地快捷、频繁和可靠。<br>它的出现是由于软件行业日益清晰地认识到：为了按时交付软件产品和服务，开发和运维工作必须紧密合作。</p>
<img src="/blog/2022/01/06/blog/dev-ops/dev-ops/DevOps.png">
<a id="more"></a>
<h2 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h2><p>可以把DevOps看作开发（软件工程）、技术运营和质量保障（QA）三者的交集。<br>开发运维平台涵盖了持续集成（Continuous Integration）、持续交付（Continuous Delivery）和持续部署（Continuous Deployment）。</p>
<h2 id="开发（软件工程）"><a href="#开发（软件工程）" class="headerlink" title="开发（软件工程）"></a>开发（软件工程）</h2><h3 id="Scrum"><a href="#Scrum" class="headerlink" title="Scrum"></a>Scrum</h3><p>Scrum是敏捷开发模式的一种。在Scrum模式下，团队通过不断迭代来对产品进行增量交付。<br>一个典型的Scrum团队有5-9个成员，分3种角色：</p>
<h4 id="ScrumMaster"><a href="#ScrumMaster" class="headerlink" title="ScrumMaster"></a>ScrumMaster</h4><p>ScrumMaster协调团队的工作，为团队选择最佳的工作模式，保护团队减少外界的打扰，帮助团队解决阻塞工作进行的问题。</p>
<h4 id="Product-Owner"><a href="#Product-Owner" class="headerlink" title="Product Owner"></a>Product Owner</h4><p>Product Owner负责产品的方向，制定产品路线图和发布计划，定义产品功能优先级，为团队澄清需求。Product Owner和ScrumMaster不能是同一个人。</p>
<h4 id="团队成员"><a href="#团队成员" class="headerlink" title="团队成员"></a>团队成员</h4><p>团队成员不分开发和测试，是全功能型的开发实现团队，在任何产生瓶颈的地方，所有成员全力以赴解决。<br>一个迭代也叫一个冲刺（Sprint），一般周期长度为1-4周。在一个迭代里，成员全力交付承诺的需求。如果任何需求没有完成，则移到下一个迭代继续实现。<br>在一个迭代的周期内，有4个会议：</p>
<h5 id="迭代规划会"><a href="#迭代规划会" class="headerlink" title="迭代规划会"></a>迭代规划会</h5><p>迭代规划会的目的是为本迭代安排需求，定义需求的优先级，澄清需求。迭代规划会在迭代的第一天举行，需要整个Scrum团队参与，业务方和用户代表也可能参会。在迭代规划会上，Product Owner对需求Backlog按优先级从高到低进行讲解，每个需求讲解完毕后，现场解答团队的问题，澄清需求，然后团队一起对需求进行快速评估。不断重复这个过程直到需求工作量到达团队在本迭代内可交付的最大值。团队随后对规划到本迭代内的需求进行分配和任务拆解。</p>
<h5 id="每日站会"><a href="#每日站会" class="headerlink" title="每日站会"></a>每日站会</h5><p>每日站会的目的是为了团队了解彼此的进展和是否有阻塞工作进行的问题。每日站会从迭代的第二天开始召开，需要整个团队参加。每日站会要求尽可能简短（所以要站着开），一般不超过15分钟。如果有需要解决的问题，会后跟进，而不要在站会中解决。</p>
<h5 id="迭代评审会"><a href="#迭代评审会" class="headerlink" title="迭代评审会"></a>迭代评审会</h5><p>迭代评审会的目的是为了验收产品。迭代评审会不需要固定的时间和地点正式召开，而是团队任何成员如果有可验收的功能，就叫上Product Owner和业务方或用户代表进行验收。</p>
<h5 id="迭代回顾会"><a href="#迭代回顾会" class="headerlink" title="迭代回顾会"></a>迭代回顾会</h5><p>迭代回顾会的目的是对本迭代进行回顾，发现改进机会，让团队持续改进。迭代回顾会一般在迭代的最后一天召开，整个Scrum团队参与。迭代回顾会建议使用积极的语言，每个成员对三个问题进行反馈，以找出改进机会：<br>在本迭代中，有哪些方面做得好的，团队需要继续保持？<br>在本迭代中，有哪些方面可以做得更好的，团队需要改进？<br>在本迭代中，有哪些事情团队不应该再重复了？</p>
<h2 id="技术运营"><a href="#技术运营" class="headerlink" title="技术运营"></a>技术运营</h2><h3 id="持续集成"><a href="#持续集成" class="headerlink" title="持续集成"></a>持续集成</h3><p>持续集成强调开发人员提交了新代码之后，立刻进行构建、（单元）测试。根据测试结果，我们可以确定新代码和原有代码能否正确地集成在一起。<br><img src="Continuous Integration.png"></p>
<h3 id="持续交付"><a href="#持续交付" class="headerlink" title="持续交付"></a>持续交付</h3><p>持续交付在持续集成的基础上，将集成后的代码部署到更贴近真实运行环境的「类生产环境」（production-like environments）中。比如，我们完成单元测试后，可以把代码部署到连接数据库的 Staging 环境中更多的测试。如果代码没有问题，可以继续手动部署到生产环境中。<br><img src="Continuous Delivery.jpg"></p>
<h3 id="持续部署"><a href="#持续部署" class="headerlink" title="持续部署"></a>持续部署</h3><p><img src="Continuous Deployment.jpg"><br>持续部署则是在持续交付的基础上，把部署到生产环境的过程自动化。</p>
<h2 id="质量保障（QA）"><a href="#质量保障（QA）" class="headerlink" title="质量保障（QA）"></a>质量保障（QA）</h2><h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><h3 id="rar解压工具"><a href="#rar解压工具" class="headerlink" title="rar解压工具"></a>rar解压工具</h3><p>安装rar解压工具</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">wget https://www.rarlab.com/rar/rarlinux-x64-5.9.1.tar.gz</span><br><span class="line">tar -zxf rarlinux-x64-5.9.1.tar.gz</span><br><span class="line">cd rar</span><br><span class="line">make</span><br></pre></td></tr></table></figure>
<p>安装完成后就可以使用<code>unrar x xxx.rar</code>这个命令来解压压缩包。</p>
<h3 id="屏保cmatrix"><a href="#屏保cmatrix" class="headerlink" title="屏保cmatrix"></a>屏保cmatrix</h3><p>先要检查inux中的包: 1.gcc 2.gcc-c++ 3.make 4.ncurses-devel<br>检查四个数据包:输入gcc-v 或c+士tv或make或ncurses-develv进行查看如果没有需要进行安装包<br>一般yum istall make<br>同理yum istall gcc<br>同理yum install gcc-c++<br>同理yum install ncurses-devel<br>最后yum install cmatrix即可</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">wget https://nchc.dl.sourceforge.net/project/cmatrix/cmatrix/1.2a/cmatrix-1.2a.tar.gz</span><br><span class="line">tar xvf cmatrix-1.2a.tar.gz</span><br><span class="line">cd cmatrix-1.2a</span><br><span class="line">./configure &amp;&amp; make &amp;&amp; make install</span><br></pre></td></tr></table></figure>
<h3 id="FastDFS"><a href="#FastDFS" class="headerlink" title="FastDFS"></a>FastDFS</h3><p>1 拉取docker镜像。tracker和storage的镜像一致，所以只要下载一个就可以。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker pull season/fastdfs</span><br></pre></td></tr></table></figure></p>
<p>2 创建一个名称为tracker的容器，network采用host的方式，-v表示磁盘挂载的路径</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -tid --name tracker --network=host -v /data/dev/fdfs/tracker:/fastdfs/tracker/data season/fastdfs tracker</span><br></pre></td></tr></table></figure>
<p>如果服务器重启导致docker容器都被关闭，那么重新打开的时候，不用再指定 –name，否则会提示容器名称已存在。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -tid --network=host -v /data/dev/fdfs/tracker:/fastdfs/tracker/data season/fastdfs tracker</span><br></pre></td></tr></table></figure></p>
<p>3 创建一个名称为storage的容器，network采用host的方式，-v表示磁盘映射路径<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -tid --name storage --network=host  -v /data/dev/fdfs/storage_data:/fastdfs/storage/data -v /data/dev/fdfs/store_path:/fastdfs/store_path  -e TRACKER_SERVER:192.168.1.111:22122 -e GROUP_NAME=group1 season/fastdfs storage</span><br></pre></td></tr></table></figure></p>
<p>如果服务器重启导致docker容器都被关闭，那么重新打开的时候，不用再指定 –name，否则会提示容器名称已存在。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -tid --network=host  -v /data/dev/fdfs/storage_data:/fastdfs/storage/data -v /data/dev/fdfs/store_path:/fastdfs/store_path  -e TRACKER_SERVER:192.168.1.111:22122 -e GROUP_NAME=group1 season/fastdfs storage</span><br></pre></td></tr></table></figure>
<p>4 配置fastdfs<br>将配置文件拷贝一份出来。也可以直接进入容器修改配置文件。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">//第一种方法</span><br><span class="line">//把配置文件拷贝出来修改。</span><br><span class="line">docker cp storage:/fdfs_conf/storage.conf ./</span><br><span class="line">//修改后再覆盖回去</span><br><span class="line">docker cp ./storage.conf storage:/fdfs_conf/</span><br><span class="line"></span><br><span class="line">//第二种方法</span><br><span class="line">//进入容器修改配置文件</span><br><span class="line">docker exec -it storage bash</span><br></pre></td></tr></table></figure>
<p>修改里面的配置信息，主要是修改tracker以及端口。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># tracker_server can ocur more than once, and tracker_server format is</span><br><span class="line">#  &quot;host:port&quot;, host can be hostname or ip address</span><br><span class="line">tracker_server=192.168.1.111:22122</span><br><span class="line"># the port of the web server on this storage server</span><br><span class="line">http.server_port=8888</span><br></pre></td></tr></table></figure></p>
<p>重新启动storage容器<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">docker stop storage</span><br><span class="line">docker start storage</span><br></pre></td></tr></table></figure></p>
<p>看tracker容器和storage容器的关联情况，确认storage是否自动注册到tracker中。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">//进入到storage容器</span><br><span class="line">docker exec -it storage bash</span><br><span class="line">//找到配置文件</span><br><span class="line">cd fdfs_conf</span><br><span class="line">//查看storage是否注册到tracker中</span><br><span class="line">fdfs_monitor storage.conf</span><br><span class="line">//如果storage有成功注册到tracker中，会显示Storage 1，如果注册没有成功会提示报错信息。</span><br></pre></td></tr></table></figure></p>
<p>5 配置nginx提供访问的url</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">server &#123;</span><br><span class="line">    listen 8888;</span><br><span class="line">    server_name localhost;</span><br><span class="line">    location /group1/M00/ &#123;</span><br><span class="line">        alias /data/dev/fdfs/store_path/data/;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>其他docker常用命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//查看所有容器</span><br><span class="line">docker ps -a</span><br><span class="line">//启动容器</span><br><span class="line">docker start containerName</span><br><span class="line">//停止容器 </span><br><span class="line">docker stop containerName</span><br><span class="line">//删除容器</span><br><span class="line">docker rm containerName</span><br><span class="line">//删除镜像</span><br><span class="line">docker rmi imageId</span><br></pre></td></tr></table></figure>
<h3 id="Nginx"><a href="#Nginx" class="headerlink" title="Nginx"></a>Nginx</h3><p>第一种安装方式。<br>CentreOS支持一键安装。nginx会被安装在<code>/etc/nginx</code>目录中，log在<code>/var/logs/nginx</code>中。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install nginx</span><br></pre></td></tr></table></figure>
<p>第二种安装方式。<br>需要先安装Nginx的前置依赖。<code>-y</code>是可选参数，意思是在安装的过程中遇到<code>Is this OK[y/d/N]</code>的时候，自动选择<code>y</code>。这个其实就是和Windows环境下的默认安装是同一个道理。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">yum [-y] install gcc</span><br><span class="line">yum [-y] install pcre-devel</span><br><span class="line">yum [-y] install zlib zlib-devel</span><br><span class="line">yum [-y] install openssl openssl-devel</span><br></pre></td></tr></table></figure>
<p>下载Nginx的安装包。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget http://nginx.org/download/nginx-1.13.7.tar.gz</span><br></pre></td></tr></table></figure>
<p>解压安装包。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -xvf nginx-1.13.7.tar.gz</span><br></pre></td></tr></table></figure>
<p>运行configure。</p>
<p>参数<code>--with-http_ssl_module</code>，这个模块能够支持HTTPS。</p>
<p>参数<code>--with-http_stub_status_module</code>，这个模块能够获取Nginx自上次启动以来的工作状态</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd nginx-1.13.7/</span><br><span class="line">./configure --prefix=/usr/local/webserver/nginx --with-http_ssl_module --with-http_stub_status_module</span><br></pre></td></tr></table></figure>
<p>编译，安装。<br>make &amp;&amp; make install</p>
<h4 id="loaction"><a href="#loaction" class="headerlink" title="loaction"></a>loaction</h4><p>匹配顺序优先级：<br>（location =）&gt; (location 完整路径）&gt; (location ^~ 路径) &gt; (location ~，~*正则顺序) &gt;(location 部分起始位置) &gt; （/）</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>解释</th>
</tr>
</thead>
<tbody>
<tr>
<td>=</td>
<td>精确匹配。如果完全匹配到，则停止匹配。</td>
</tr>
<tr>
<td>^~</td>
<td>模糊匹配，最长优先。匹配到最长路径，则停止匹配。</td>
</tr>
<tr>
<td>~</td>
<td>模糊匹配，最长优先。执行一个正则匹配，区分大小写。</td>
</tr>
<tr>
<td>~*</td>
<td>模糊匹配，最长优先。执行一个正则匹配，不区分大小写。</td>
</tr>
<tr>
<td>空</td>
<td>模糊匹配，最长优先。</td>
</tr>
<tr>
<td>@</td>
<td>“@” 定义一个命名的 location，@定义的locaiton名字一般用在内部定向，例如error_page, try_files命令中。它的功能类似于编程中的goto。</td>
</tr>
</tbody>
</table>
<p>=:用于不含正则表达式的url前，要求字符串与url严格匹配，匹配成功就停止向下搜索并处理请求。</p>
<p>~：用于表示url包含正则表达式，并且区分大小写。</p>
<p>~*：用于表示url包含正则表达式，并且不区分大小写</p>
<p>^~：用于不含正则表达式的url前，要求ngin服务器找到表示url和字符串匹配度最高的location后，立即使用此location处理请求，而不再匹配<br>如果有url包含正则表达式，不需要有~开头标识</p>
<h4 id="root、alias、prox-pass"><a href="#root、alias、prox-pass" class="headerlink" title="root、alias、prox_pass"></a>root、alias、prox_pass</h4><p>location中的root和alias的最大区别是：<br>root的结果是<code>root+location</code>，匹配到的url会拼接到root后面。<br>alias的结果是<code>location替换alias相同的部分</code>，匹配到的url会先扣除掉location然后再拼接到alias后面。因为会先扣除掉location，有可能扣完后的url只剩下一串字符<code>abcdefg</code>，这时候如果alias后面没有<code>/</code>则会导致<code>abcdefg</code>直接拼接到alias后面。所以，alias后的的路径最好要以<code>/</code>结尾，确保凭借出来的路径没错。</p>
<p>使用root配置，访问的URL是<code>/test/a.html</code>，匹配到的location是<code>/test/</code>，实际指向的是 <code>root + URL</code> 即 <code>/home/www/test/a.html</code>。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">location /test/ &#123;</span><br><span class="line">    root /home/www/;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>使用alias配置，访问的URL是<code>/test/a.html</code>，匹配到的location是<code>/test/</code>，实际指向的是 <code>alias + URL - location</code> 即 <code>/home/www/a.html</code>。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">location /test/ &#123;</span><br><span class="line">    alias /home/www/;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>prox_pass与alias类似，访问的URL是<code>/test/a.html</code>，匹配到的location是<code>/test/</code>，实际指向的是 <code>alias + URL - location</code> 即 <code>http://127.0.0.1:8080/a.html</code>。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">localtion /test/ &#123;</span><br><span class="line">    proxy_pass http://127.0.0.1:8080/;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="try-files"><a href="#try-files" class="headerlink" title="try_files"></a>try_files</h4><p>按顺序检查参数列出的文件是否存在，返回第一个找到的文件。结尾有斜线的 <code>$uri/</code> 表示文件夹。如果所有的文件都找不到，会发生一个内部重定向到最后一个参数。这里简单记住一句话：按顺序尝试路径。</p>
<p>只有最后一个参数可以引起内部重定向，之前的参数只能设置为文件或文件夹。</p>
<p>最后一个参数是前面列出的文件或文件夹都不存在时的兜底回调，如果这个路径不存在，将会返回500错误。</p>
<p>最后一个参数也可以是命名的location。与rewrite指令不同，如果回调URI不是命名的location那么$args不会自动传递，如果你想保留$args，必须明确声明参数。</p>
<p>例如以下配置意思是：依次尝试<code>/a/b/$uri</code>，如果找不到就找<code>/a/b/$uri/</code>，如果找不到就找<code>/a/b/c/index.html</code></p>
<p>注意：最后一个参数如果包含路径，那么有没有斜杠意义不一样，相对的路径也不一样。<br><code>/c/index.html</code>有斜杠<code>/</code>相对的是root指向的路径<code>/a/b</code>，最终的路径是<code>/a/b/c/index.html</code><br><code>c/index.html</code>没有斜杠<code>/</code>相对的nginx默认的路径<code>nginx/html</code>，最终的路径是<code>nginx/html/c/index.html</code></p>
<h4 id="前端工程化部署用到的两个知识点"><a href="#前端工程化部署用到的两个知识点" class="headerlink" title="前端工程化部署用到的两个知识点"></a>前端工程化部署用到的两个知识点</h4><p>第一个知识点：nginx的try_files。<br>如果 <code>$uri</code> 文件和 <code>$uri/</code> 文件夹都找不到的话，那就直接返回 <code>/a/b/c/index.html</code> 文件。<br>第二个知识点：前端路由定位。<br>返回文件后，这个文件包含了整个前端应用的入口，前端会根据顶部的url去定位具体到哪个功能菜单。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">location /test &#123;</span><br><span class="line">    root /a/b;</span><br><span class="line">    index index.html;</span><br><span class="line">    try_files $uri $uri/ /c/index.html;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="伪静态"><a href="#伪静态" class="headerlink" title="伪静态"></a>伪静态</h4><p>这些是伪静态，真是的路径已经被隐藏。</p>
<p><a href="http://www.xxab.com/hello/world.html" target="_blank" rel="noopener">http://www.xxab.com/hello/world.html</a><br><a href="http://www.xxx.com/content/23223.html" target="_blank" rel="noopener">http://www.xxx.com/content/23223.html</a><br><a href="http://www.xxx.com/content/go/cb" target="_blank" rel="noopener">http://www.xxx.com/content/go/cb</a></p>
<p>原生URL</p>
<p><a href="http://www.xxx.com/index.php?name=will&amp;age=20" target="_blank" rel="noopener">http://www.xxx.com/index.php?name=will&amp;age=20</a><br><a href="http://www.xxx.com/content/list.php?id=3" target="_blank" rel="noopener">http://www.xxx.com/content/list.php?id=3</a></p>
<p><code>$uri</code> 这个是nginx的一个变量，存放着用户访问的地址，比如：<code>http://www.xxx.com/index.html</code>，<code>$uri</code>就是 <code>/index.html</code><br><code>$uri/</code> 代表访问的是一个目录，比如：<code>http://www.xxx.com/hello/test/</code>，那么<code>$uri/</code>就是<code>/hello/test/</code><br>完整的解释就是：try_files 去尝试到网站目录读取用户访问的文件，如果第一个变量存在，就直接返回；不存在继续读取第二个变量，如果存在，直接返回；不存在直接跳转到第三个参数上。</p>
<p>比如用户访问这个网地址：<code>http://www.xxx.com/test.html</code><br><code>try_files</code>首先会判断他是文件，还是一个目录，结果发现他是文件，与第一个参数 <code>$uri</code> 变量匹配。<br>然后去到网站目录下去查找<code>test.html</code>文件是否存在，如果存在直接读取返回。如果不存在直接跳转到第三个参数，而第三个参数是一个location,而这个location里面配置的就是rewrite规则。第三个参数也可以是直接一个文件。</p>
<p>rewrite这个指令把所有请求过来的url地址，都与htaccess文件中的正则地址进行一次匹配，这样的话，静态的url地址也进行了一次匹配，比如<code>http://xxxx.com/aa.png</code>,这个地址是不需要重写的，但是rewrite也进行了一次匹配，这就浪费服务器资源，影响执行效率。而我们真正需要匹配的，其实都是一些动态url地址。</p>
<h4 id="安装https模块和证书"><a href="#安装https模块和证书" class="headerlink" title="安装https模块和证书"></a>安装https模块和证书</h4><p>先到阿里云购买免费证书。<br><img src="buy_ca.png"></p>
<p>在nginx监听443端口，配置上证书的路径。</p>
<p>以下配置能达到几个效果：</p>
<ul>
<li>访问<code>http://www.domain.com</code>默认跳转到<code>https://www.domain.com</code></li>
<li>访问<code>http://www.domain.com/</code>会自动加上blog作为结尾，<code>https://www.domain.com/blog</code></li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line">http &#123;</span><br><span class="line">    server &#123;</span><br><span class="line">        listen       80;</span><br><span class="line">        server_name  www.domain.com;</span><br><span class="line">        # 监听80端口，把所有地址都跳转到https</span><br><span class="line">        rewrite ^(.*) https://$server_name$1 permanent;</span><br><span class="line">    &#125;</span><br><span class="line">    server &#123;</span><br><span class="line">        listen       443 ssl;</span><br><span class="line">        server_name  www.domain.com;</span><br><span class="line"></span><br><span class="line">        ssl_certificate     ../cert/xxx.pem;</span><br><span class="line">        ssl_certificate_key  ../cert/xxx.key;</span><br><span class="line"></span><br><span class="line">        ssl_session_cache    shared:SSL:1m;</span><br><span class="line">        ssl_session_timeout  5m;</span><br><span class="line"></span><br><span class="line">        ssl_ciphers  HIGH:!aNULL:!MD5;</span><br><span class="line">        ssl_prefer_server_ciphers  on;</span><br><span class="line">        location = / &#123;# 只会匹配到www.domain.com这种请求</span><br><span class="line">            add_header  Cache-Control  no-cache;</span><br><span class="line">            # 在地址后面加上/blog</span><br><span class="line">            rewrite ^(.*)$ $1/blog permanent;</span><br><span class="line">        &#125;</span><br><span class="line">        location /blog &#123;</span><br><span class="line">            #proxy_pass http://127.0.0.1:4000/blog;</span><br><span class="line">            alias /var/www/;</span><br><span class="line">            index index.html index.htm;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="限流"><a href="#限流" class="headerlink" title="限流"></a>限流</h4><p>限流其实就是对流量的限制，让流量不要那么快那么大量的访问服务器。因此限流可以从两个方面进行，一个是限速，另一个是限量。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">http &#123;</span><br><span class="line">    limit_req_zone  $binary_remote_addr  zone=one:10m   rate= 100r/s;</span><br><span class="line">    ...</span><br><span class="line">    server &#123;</span><br><span class="line">        ...</span><br><span class="line">        location /search/ &#123;</span><br><span class="line">            limit_req   zone=one  burst=5;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<blockquote>
<p>limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;</p>
</blockquote>
<ul>
<li>第一个参数：$binary_remote_addr 表示通过remote_addr这个标识来做限制，“binary_”的目的是缩写内存占用量，是限制同一客户端ip地址。</li>
<li>第二个参数：zone=one:10m表示生成一个大小为10M，名字为one的内存区域，用来存储访问的频次信息。</li>
<li>第三个参数：rate=1r/s表示允许相同标识的客户端的访问频次，这里限制的是每秒1次，还可以有比如30r/m的。nginx限速可以精确到ms，100r/s就相当于每10ms通过一个请求</li>
</ul>
<blockquote>
<p>limit_req zone=one burst=5 nodelay;</p>
</blockquote>
<ul>
<li>第一个参数：zone=one 设置使用哪个配置区域来做限制，与上面limit_req_zone 里的name对应。</li>
<li>第二个参数：burst=5，重点说明一下这个配置，burst爆发的意思，这个配置的意思是设置一个大小为5的缓冲区当有大量请求（爆发）过来时，超过了访问频次限制的请求可以先放到这个缓冲区内。</li>
<li>第三个参数：nodelay，如果设置，超过访问频次而且缓冲区也满了的时候就会直接返回503，如果没有设置，则所有请求会等待排队。</li>
</ul>
<h3 id="并发测试"><a href="#并发测试" class="headerlink" title="并发测试"></a>并发测试</h3><h4 id="ab测试"><a href="#ab测试" class="headerlink" title="ab测试"></a>ab测试</h4><blockquote>
<p>ab -n20000 -c10000 -k <a href="http://ruolong.wang/" target="_blank" rel="noopener">http://ruolong.wang/</a><br>-n20000意思是20000个请求，-c10000意思是10000个并发，-k意思是长连接</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">Server Software:        nginx/1.14.0</span><br><span class="line">Server Hostname:        ruolong.wang</span><br><span class="line">Server Port:            80</span><br><span class="line"></span><br><span class="line">Document Path:          /</span><br><span class="line">Document Length:        185 bytes</span><br><span class="line"></span><br><span class="line">Concurrency Level:      10000</span><br><span class="line">Time taken for tests:   89.009 seconds</span><br><span class="line">Complete requests:      20000</span><br><span class="line">Failed requests:        124</span><br><span class="line">   (Connect: 0, Receive: 0, Length: 124, Exceptions: 0)</span><br><span class="line">Non-2xx responses:      19876</span><br><span class="line">Keep-Alive requests:    19876</span><br><span class="line">Total transferred:      7652260 bytes</span><br><span class="line">HTML transferred:       3677060 bytes</span><br><span class="line">Requests per second:    224.70 [#/sec] (mean)</span><br><span class="line">Time per request:       44504.722 [ms] (mean)</span><br><span class="line">Time per request:       4.450 [ms] (mean, across all concurrent requests)</span><br><span class="line">Transfer rate:          83.96 [Kbytes/sec] received</span><br><span class="line"></span><br><span class="line">Connection Times (ms)</span><br><span class="line">              min  mean[+/-sd] median   max</span><br><span class="line">Connect:        0  523 4438.9      0   65752</span><br><span class="line">Processing:    19 1860 6546.4    249   64722</span><br><span class="line">Waiting:       19 2192 7942.5    249   64722</span><br><span class="line">Total:         19 2383 8029.6    249   80241</span><br></pre></td></tr></table></figure>
<h4 id="jmeter测试"><a href="#jmeter测试" class="headerlink" title="jmeter测试"></a>jmeter测试</h4><h3 id="MySQL"><a href="#MySQL" class="headerlink" title="MySQL"></a>MySQL</h3><p>今天在centeros上面安装mysql，安装完后怎么都启动不了，差点就把电脑重装了，最后修改了my.cnf才解决了问题。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">table_open_cache=4</span><br><span class="line">query_cache_limit=256K</span><br><span class="line">query_cache_size=32M</span><br><span class="line">max_allowed_packet=1024M</span><br><span class="line">sort_buffer_size=6M</span><br><span class="line">read_buffer_size=4M</span><br><span class="line">thread_stack=256K</span><br><span class="line">innodb_buffer_pool_size = 512M</span><br></pre></td></tr></table></figure>
<blockquote>
<p>service mysqld restart</p>
</blockquote>
<p>这是优化过后的my.cnf</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">[mysqld]</span><br><span class="line">server-id=1</span><br><span class="line">binlog-ignore_db=mysql</span><br><span class="line"></span><br><span class="line">datadir=/var/lib/mysql</span><br><span class="line">socket=/var/lib/mysql/mysql.sock</span><br><span class="line">user=mysql</span><br><span class="line"># Disabling symbolic-links is recommended to prevent assorted security risks</span><br><span class="line">symbolic-links=0</span><br><span class="line">max_connections=10000</span><br><span class="line">max_connect_errors = 1000000</span><br><span class="line">max_allowed_packet=1024M</span><br><span class="line">#最大并发线程数</span><br><span class="line">thread_concurrency=8</span><br><span class="line">#跳过反向解析</span><br><span class="line">skip-name-resolve  </span><br><span class="line">#skip-locking</span><br><span class="line">#back_log = 500  </span><br><span class="line">wait_timeout = 120</span><br><span class="line"></span><br><span class="line">#缓存可重用的线程数</span><br><span class="line">thread_cache = 128</span><br><span class="line"></span><br><span class="line"># 开启日志分析</span><br><span class="line">#log-slow-queries=/var/log/mysql-m.log</span><br><span class="line">long_query_time=3</span><br><span class="line"></span><br><span class="line">innodb_buffer_pool_size=512M</span><br><span class="line"></span><br><span class="line">thread_stack=256K</span><br><span class="line">#table_cache=512</span><br><span class="line">sort_buffer_size = 6M</span><br><span class="line">read_buffer_size=4M</span><br><span class="line">query_cache_size=32M</span><br><span class="line">query_cache_type= 1</span><br><span class="line">lower_case_table_names=1</span><br><span class="line">innodb_lock_wait_timeout = 120 </span><br><span class="line"></span><br><span class="line">[mysqld_safe]</span><br><span class="line">log-error=/var/log/mysqld.log</span><br><span class="line">pid-file=/var/run/mysqld/mysqld.pid</span><br></pre></td></tr></table></figure>
<h4 id="MySQL常用命令"><a href="#MySQL常用命令" class="headerlink" title="MySQL常用命令"></a>MySQL常用命令</h4><p>创建用户msadmin，设置密码123456，授权增删改查，可以远程登录，只能访问shop数据库。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">GRANT INSERT,DELETE,UPDATE,SELECT ON shop.* TO &apos;msadmin&apos;@&apos;%&apos; IDENTIFIED BY &apos;123456&apos;;</span><br></pre></td></tr></table></figure></p>
<p>创建用户msadmin，设置密码123456，授权所有权限，可以远程登录，智能访问shop数据库。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">GRANT ALL PRIVILEGES ON shop.* TO &apos;msadmin&apos;@&apos;%&apos; IDENTIFIED BY &apos;123456&apos;;</span><br></pre></td></tr></table></figure></p>
<h4 id="MySQL常见问题"><a href="#MySQL常见问题" class="headerlink" title="MySQL常见问题"></a>MySQL常见问题</h4><h5 id="忘记密码"><a href="#忘记密码" class="headerlink" title="忘记密码"></a>忘记密码</h5><p>大体思路是先修改服务器中的my.conf配置文件，跳过权限验证，然后进入mysql修改用户密码，最后把跳过权限验证的去掉即可。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">#找到`/etc/my.conf`在里面加上`skip-grant-tables`跳过权限验证</span><br><span class="line">vi /etc/my.conf</span><br><span class="line">#重启mysql服务</span><br><span class="line">service mysql restart</span><br><span class="line">#命令行进入mysql</span><br><span class="line">mysql -uroot -p</span><br><span class="line">#使用mysql库</span><br><span class="line">&gt; use mysql;</span><br><span class="line">#修改user表，设置用户密码</span><br><span class="line">&gt; update user set authentication_string=password(&apos;123456&apos;) where user=&apos;root&apos;;</span><br><span class="line">如果有修改权限要刷新权限</span><br><span class="line">&gt; flush privileges;</span><br></pre></td></tr></table></figure>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/Linux服务器/" rel="tag"># Linux服务器</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/11/03/blog/web-front-end-advance/web-front-end-advance/" rel="next" title="Web前端进阶">
                <i class="fa fa-chevron-left"></i> Web前端进阶
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2022/01/24/blog/source-code-mirrorjs/source-code-mirrorjs/" rel="prev" title="MirrorJS源码解读">
                MirrorJS源码解读 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">对美好事物的向往，心中要充满强烈的愿望！</p>
              <p class="site-description motion-element" itemprop="description">沉淀下来的知识，才是真正的财富！</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/blog/archives/">
                
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/blog/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">22</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/blog/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#概述"><span class="nav-number">1.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#开发（软件工程）"><span class="nav-number">2.</span> <span class="nav-text">开发（软件工程）</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Scrum"><span class="nav-number">2.1.</span> <span class="nav-text">Scrum</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#ScrumMaster"><span class="nav-number">2.1.1.</span> <span class="nav-text">ScrumMaster</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Product-Owner"><span class="nav-number">2.1.2.</span> <span class="nav-text">Product Owner</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#团队成员"><span class="nav-number">2.1.3.</span> <span class="nav-text">团队成员</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#迭代规划会"><span class="nav-number">2.1.3.1.</span> <span class="nav-text">迭代规划会</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#每日站会"><span class="nav-number">2.1.3.2.</span> <span class="nav-text">每日站会</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#迭代评审会"><span class="nav-number">2.1.3.3.</span> <span class="nav-text">迭代评审会</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#迭代回顾会"><span class="nav-number">2.1.3.4.</span> <span class="nav-text">迭代回顾会</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#技术运营"><span class="nav-number">3.</span> <span class="nav-text">技术运营</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#持续集成"><span class="nav-number">3.1.</span> <span class="nav-text">持续集成</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#持续交付"><span class="nav-number">3.2.</span> <span class="nav-text">持续交付</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#持续部署"><span class="nav-number">3.3.</span> <span class="nav-text">持续部署</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#质量保障（QA）"><span class="nav-number">4.</span> <span class="nav-text">质量保障（QA）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#其他"><span class="nav-number">5.</span> <span class="nav-text">其他</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#rar解压工具"><span class="nav-number">5.1.</span> <span class="nav-text">rar解压工具</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#屏保cmatrix"><span class="nav-number">5.2.</span> <span class="nav-text">屏保cmatrix</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#FastDFS"><span class="nav-number">5.3.</span> <span class="nav-text">FastDFS</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Nginx"><span class="nav-number">5.4.</span> <span class="nav-text">Nginx</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#loaction"><span class="nav-number">5.4.1.</span> <span class="nav-text">loaction</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#root、alias、prox-pass"><span class="nav-number">5.4.2.</span> <span class="nav-text">root、alias、prox_pass</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#try-files"><span class="nav-number">5.4.3.</span> <span class="nav-text">try_files</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#前端工程化部署用到的两个知识点"><span class="nav-number">5.4.4.</span> <span class="nav-text">前端工程化部署用到的两个知识点</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#伪静态"><span class="nav-number">5.4.5.</span> <span class="nav-text">伪静态</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#安装https模块和证书"><span class="nav-number">5.4.6.</span> <span class="nav-text">安装https模块和证书</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#限流"><span class="nav-number">5.4.7.</span> <span class="nav-text">限流</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#并发测试"><span class="nav-number">5.5.</span> <span class="nav-text">并发测试</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#ab测试"><span class="nav-number">5.5.1.</span> <span class="nav-text">ab测试</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#jmeter测试"><span class="nav-number">5.5.2.</span> <span class="nav-text">jmeter测试</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#MySQL"><span class="nav-number">5.6.</span> <span class="nav-text">MySQL</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#MySQL常用命令"><span class="nav-number">5.6.1.</span> <span class="nav-text">MySQL常用命令</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#MySQL常见问题"><span class="nav-number">5.6.2.</span> <span class="nav-text">MySQL常见问题</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#忘记密码"><span class="nav-number">5.6.2.1.</span> <span class="nav-text">忘记密码</span></a></li></ol></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright"> &copy; <span itemprop="copyrightYear">2024</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">对美好事物的向往，心中要充满强烈的愿望！</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.9.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a> v6.4.2</div>




        








        
        <div>
          <a href="https://beian.miit.gov.cn/" target="_blank">闽ICP备15015722号-2</a>
        </div>
      </div>
     
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=6.4.2"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=6.4.2"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=6.4.2"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=6.4.2"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=6.4.2"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=6.4.2"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=6.4.2"></script>



  



  










  





  

  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
